<template>
  <Page name="个人资料">
    <div class="info">
        <ul>
          <li>
            <span>头像</span>
            <span>
              <img :src=" data.avatar" alt="" v-if="data.avatar!=''">
              <img :src="defaultImg" alt="" v-else>
            </span>
          </li>
          <li v-if="data.nickname!=''">
            <span>昵称</span>
            <span>{{data.nickname}}</span>
          </li>
          <li v-if="data.name!=''">
            <span>姓名</span>
            <span>{{data.name}}</span>
          </li>
          <li>
            <span>户口号</span>
            <span>{{data.lema_code}}</span>
          </li>
          <li>
            <span>我的上线</span>
            <span v-if="data.status==2" class="noparentname">{{data.parentname}}</span>
            <span v-if='data.status==0' class="ing">
              {{data.parentname}}
            </span>
            <span v-if='data.status==-1' class="fail">
              {{data.parentname}}
            </span>
            <span v-if='data.status==1' >
              {{data.parentname}}
            </span>
          </li>
        </ul>
    </div>
  </Page>
</template>
<script>


import Page from '~/components/page';
export default {
  components: {
    Page,
  },
  data() {
    return {
      data:{},
      defaultImg:require('~/assets/img/gerenziliao_touxiang@2x.png'),
    }
  },
  methods: {
    async getDate(){
        let { data:rs } = await this.$axios.post('?ct=api&ac=get_user')
        if(rs.code == 0){
          this.data = rs.data;
        }else{
          this.$toast(rs.msg)
        }
    }
  },
  mounted() {
    (async ()=>{
      await this.getDate();
    })();
  },
}
</script>

<style lang="less" scoped>
  .info{
    margin-top:30px;
    ul{
      padding-left:30px;
      background: #fff;
      li{
        padding:30px 20px;
        padding-left:0;
        border-bottom:1px solid #ededed;
        display: flex;
        align-items: center;
        span:first-child{
          font-size:32px;
          color:#292929;
        }
        span:last-child{
          flex: 1;
          text-align: right;
          font-size:30px;
          color:#666;
          img{
            width:90px;
            height:90px;
            border-radius: 90px;
            display:inline-block;
          }
        }
        span.noparentname{
          color:#999;
        }
        span.fail{
          color:#f05521;
        }
        span.ing{
          color:#d39b00;
        }
      }
    }
  }

</style>
